package br.com.vestibulation.dao;

import br.com.vestibulation.bean.Relatorio;

public class RelatorioDAO extends ConnectionFactory{
    public Relatorio buscarRelatorios(String usuario){
        Relatorio relatorio = new Relatorio();
        try{
            if(abrir()){
                stmt = conn.prepareStatement("SELECT * FROM relatorio WHERE usuario = ?");
                stmt.setString(1, usuario.toLowerCase());
                rs = stmt.executeQuery();
                while(rs.next()){
                    relatorio.setAcertos(relatorio.getAcertos()+rs.getInt("numAcertos"));
                    relatorio.setRespondidas(relatorio.getRespondidas()+5);
                }
            }
        } catch(Exception ex){
        } finally{
            fechar();
        }
        return relatorio;
    }
}